﻿Chenxin.UI.DZFinancePayedDetail = Chenxin.extend(Chenxin.UI.PageCommon, {
    autoInitForm: false,
    actionUrl: '/service/logic/DZFinancePayedDetail.ashx',
    createSearch: function() {
        return new Chenxin.UI.DZFinancePayedDetailSearch({
            scope: this
        });
    }
});

/*
* 查询面板
*/
Chenxin.UI.DZFinancePayedDetailSearch = Chenxin.extend(Chenxin.UI.SearchCommon, {
    id: 'search',
    createComboList: function() {
        var _this = this;
        var combl = new Chenxin.UI.StructComboList({
            tbxWidth: 55,
            cityAfterSelected: function() {
                comboUserId.reset();
            },
            companyAfterSelected: function() {
                comboUserId.reset();
            },
            businessDistrictAfterSelected: function() {
                comboUserId.reset();
            },
            departsAfterSelected: function(val) {
                comboUserId.reset();
                if (val != '请选择') {
                    comboUserId.loadUser(val, 500);
                }
            }
        });
        //人员
        var comboUserId = new Chenxin.UI.RichModelTreeCombo({
            textBoxId: 'txtUser',
            inModelType: 'all',
            txtModelName: 'UserName',
            singleSelect: true,
            name: 'UserId'
        });
        var structs = combl.comboList;
        structs.push(comboUserId);
        return structs;
    },
    initEvent: function() {
        var date = new Date();
        $("#CalculateDate").focus(function() {
            WdatePicker({
                dateFmt: 'yyyy-MM',
                oncleared: function() {
                    $(this).blur();
                },
                onpicked: function() {
                    $(this).blur();
                }
            });
        }).val(date.getFullYear() + '-' + (date.getMonth() + 1));

        var objSrh = this;

        $('#export').click(function() {
            var _this = this;
            Chenxin.Msg.Loading.show();
            Chenxin.ajax({
                type: "get",
                dataType: "json",
                url: '/service/logic/DZFinancePayedDetail.ashx',
                data: { op: 'checkpermit', code: 'export' },
                onSuccess: function(data) {
                    Chenxin.Msg.Loading.hide();
                    Chenxin.Fn.exportToExcel($('#search_table').html());
                }
            });
        });
        /*********事件：检索按钮*********/
        $("#btn_search").click(function() {
            Chenxin.Msg.Loading.show();
            Chenxin.ajax({
                type: 'get',
                dataType: 'html',
                url: '/service/logic/DZFinancePayedDetail.ashx?op=getlist',
                data: objSrh.getParamJson(),
                onSuccess: function(data, msg) {
                    $('#search_table').empty();
                    $('#search_table').html(data.html);
                    Chenxin.Msg.Loading.hide();
                }
            });
        });
    }
});

getcity = true; //设置需要获取城市下拉框数据

$(function() {
    var objPg = new Chenxin.UI.DZFinancePayedDetail();
});